

#ifndef NODETOP_H
#define	NODETOP_H

#include <QtGui>
#include "Node.h"

class NodeTop : public Node {
    Q_OBJECT

public:
    NodeTop(const QPoint &pos, QWidget* parent);

    NodeTop(const QPoint &pos, QWidget* parent, Node* child);

    QString toCasString() const {
        return getSingleChild()->toCasString();
    }

    QString toPrintString() const {
        return getSingleChild()->toPrintString();
    }

    QString toParseString() const {
        return getSingleChild()->toParseString();
    }

    bool isConstant() const {
        return getSingleChild()->isConstant();
    }

    QSize sizeHint() const {
        return getSingleChild()->sizeHint();
    }

    void focusOut();

    void upDateSize();

    int getInputPosition(bool& found) const;
    void setInputPosition(int& position);

    std::vector<Node*> getEquals() const;

    Controller* getController();

private:
    /**
     * Static int to keep track of next number to put in name of node.
     */
    static int topNodeNumber;

    void keyPressEvent(QKeyEvent *event);
    void insertKey(QKeyEvent *event, int cursorPosition);
    void moveKey(QKeyEvent *event, int cursorPosition);

};

#endif	/* NODETOP_H */

